<template>
	<view style="">
		<image src="/static/sybj.png" class="qjimg" mode=""></image>
		<view class="title">
			<image @click="fanhui" src="/static/zfh.png" :style="'margin-top:'+top+'px;'" mode=""></image>
			<view class="toptit" :style="'margin-top:'+top+'px;'">
				报修工单
			</view>
			<view class="" style="opacity: 0;">12</view>
		</view>
		<view class="xgzl" @click="sift">
			筛选
			<image src="../../static/sjxh.png" mode=""></image>
		</view>
		<view class="tab">
			<view :class="stater==0?'tab2':'tab1'" @click="tab(0)">
				待受理
			</view>
			<view :class="stater==1?'tab2':'tab1'" @click="tab(1)">
				已完成
			</view>
		</view>
		<view class="center">
			<view class="box" v-for="(item,index) in gdlist" :key="index">
				<view class="box_title">
					{{item.communityName}}{{item.roomname}}
					<!-- <image class="topimg" src="../../static/jx8.png" mode=""></image> -->
					<view :class="stater==0?'topimg':'topimg11'">
						{{item.formatstatus}}
					</view>
				</view>
				<view class="box_2">
					<view class="box_2text">
						报修人： <text>{{item.name}}</text>
					</view>
					<view class="box_2text">
						报修时间：<text>{{item.ctime}}</text>
					</view>
					<view class="box_2text">
						报修类型： <text>{{item.formattype}}</text>
					</view>
					<view class="box_2text" v-if="stater==1">
						修理工： <text>{{item.toname}}</text>
					</view>
				</view>
				<view class="buttom">
					<view class="buttom1" @click="info(item.id)">
						报修详情
					</view>
					<view style="width: 20rpx;height: 10rpx;">

					</view>
				</view>
			</view>

		</view>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				top: 0,
				stater: 0,
				communityId: '',
				gdlist: [],
				nextp: 1,
				datetime: '',
				proid: '',
				roomId: '',
				keyword: ''
			}
		},
		onLoad() {
			this.communityId = uni.getStorageSync('communityId')
			let menuButtonInfo = uni.getMenuButtonBoundingClientRect()
			// this.CustomBar = menuButtonInfo.bottom * 1 + 10
			this.top = menuButtonInfo.top * 1 + 10
		},
		onShow() {
			this.nextp = 1
			this.getlist()
		},
		onReachBottom() {
			this.getlist()
		},
		methods: {
			tab(e) {
				this.nextp = 1
				this.stater = e
				this.getlist()
			},
			getlist() {
				if (this.nextp) {
					this.$post('wuyecenter/baoxiulist', {
						type: this.stater,
						communityId: this.communityId,
						p: this.nextp,
						datetime: this.datetime,
						proid: this.proid,
						roomId: this.roomId,
						keyword: this.keyword
					}, res => {
						if (this.nextp == 1) {
							this.gdlist = res.data.list
						} else if (this.nextp) {
							res.data.list.forEach(item => {
								this.gdlist.push(item)
							})
						}
						this.nextp = res.data.nextp
					})
				} else {
					uni.showToast({
						title: '没有数据了！',
						icon: 'none'
					})
				}

			},

			info(id) {
				uni.navigateTo({
					url: '/pages/baoxiugongdan/bxddinfo?id=' + id
				})
			},
			sift() {
				uni.navigateTo({
					url: '/pages/baoxiugongdan/bxgdSift'
				})
			},
			fanhui() {
				uni.navigateBack({
					delta: 1
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background-color: rgb(250, 250, 250);
	}

	.qjimg {
		width: 750rpx;
		height: 729rpx;
		position: absolute;
		top: 0;
		z-index: -1;
	}

	.title {
		display: flex;
		justify-content: space-between;
		align-items: center;

		>image {
			width: 20rpx;
			height: 35rpx;
			margin-left: 30rpx;
		}
	}

	.toptit {
		text-align: center;
		font-size: 36rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #ffffff;
	}

	.center {
		margin-top: 70rpx;
	}

	.xgzl {
		width: 162rpx;
		height: 60rpx;
		position: absolute;
		right: 20rpx;
		margin-top: 30rpx;
		border-radius: 30rpx;
		background-color: white;
		font-size: 26rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		text-align: center;
		line-height: 60rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		>image {
			width: 16rpx;
			height: 9rpx;
			margin-left: 10rpx;
		}
	}

	.tab {
		margin-top: 160rpx;
		display: flex;
		justify-content: space-evenly;
	}

	.tab2 {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 30rpx;
		padding-bottom: 10rpx;
		border-bottom: 2px solid #d5e5ff;
	}

	.tab1 {
		font-size: 30rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 30rpx;
	}

	.box {
		width: 700rpx;
		margin: 20rpx auto;
		padding: 20rpx 0;
		background-color: white;
		border-radius: 20rpx;
		// box-shadow: 0px 0px 20px 0 #f5f5f5;
	}

	.box_title {
		// border-left: 8rpx solid #4ab6f9;
		// width: 180rpx;
		// text-align: center;
		width: 91%;
		padding-top: 10rpx;
		margin: 0 auto;
		font-size: 28rpx;
		font-family: Source Han Sans CN;
		font-weight: bold;
		color: #000000;
		line-height: 28rpx;
		// line-height: 20rpx;
	}

	.box_2 {
		width: 91%;
		margin: 30rpx auto;
		border-bottom: #e2e2e2 solid 2rpx;
	}

	.box_2text {
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 400;
		color: #999999;
		// line-height: 20rpx;
		margin: 30rpx 0;

		>text {
			color: #999999;
		}
	}

	.topimg {
		position: absolute;
		background-image: url('../../static/jx8.png');
		background-size: 123rpx;
		margin-top: -56rpx;
		text-align: center;
		right: 26rpx;
		width: 123rpx;
		height: 41rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 41rpx;
	}

	.topimg1 {
		position: absolute;
		background-image: url('../../static/jx7.png');
		background-size: 123rpx;
		margin-top: -56rpx;
		text-align: center;
		right: 26rpx;
		width: 123rpx;
		height: 41rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #FFFFFF;
		line-height: 41rpx;
	}

	.topimg11 {
		position: absolute;
		background-image: url('../../static/jx.png');
		background-size: 123rpx;
		margin-top: -56rpx;
		text-align: center;
		right: 26rpx;
		width: 123rpx;
		height: 41rpx;
		font-size: 20rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #2D75FC;
		line-height: 41rpx;
	}


	.texta {
		width: 91%;
		height: 170rpx;
		margin: 0 auto;
		background-color: #f6f6f6;
	}

	.buttom {
		display: flex;
		justify-content: flex-end;
		overflow: hidden;
	}

	.buttom1 {
		width: 122rpx;
		height: 50rpx;
		border: #2d75fc solid 2px;
		color: #2d75fc;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #2E79FC;
		line-height: 50rpx;
		border-radius: 10rpx;
	}

	.buttom11 {
		width: 122rpx;
		height: 50rpx;
		border: #61d6c6 solid 2px;
		color: #61d6c6;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #61d6c6;
		line-height: 50rpx;
		border-radius: 10rpx;
	}

	.buttom111 {
		width: 122rpx;
		height: 50rpx;
		border: #e8f1ff solid 2px;
		color: #e8f1ff;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: #2D75FC;
		line-height: 50rpx;
		border-radius: 10rpx;
	}

	.buttom2 {
		margin: 0 20rpx;
		width: 122rpx;
		height: 50rpx;
		background-color: #49b5f9;
		border: #49b5f9 solid 2px;
		color: #ffffff;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		line-height: 50rpx;
		border-radius: 10rpx;
	}

	.buttom22 {
		margin: 0 20rpx;
		width: 122rpx;
		height: 50rpx;
		background-color: #61d6c6;
		border: #61d6c6 solid 2px;
		color: #ffffff;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		line-height: 50rpx;
		border-radius: 10rpx;
	}

	.buttom222 {
		margin: 0 20rpx;
		width: 122rpx;
		height: 50rpx;
		background-color: #e8f1ff;
		border: #e8f1ff solid 2px;
		color: #2D75FC;
		text-align: center;
		font-size: 24rpx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		line-height: 50rpx;
		border-radius: 10rpx;
	}
</style>
